<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<script src="<c:url value='/js/jquery.min.js'/>"></script>
<script src="<c:url value='/js/jquery.form.js'/>"></script>
<script type="text/javascript">
	$(document).ready(function() {
		var options = {
			success : function(data) {
				$("#working-area").html(data);
			}
		};
		$("#add-group-form").ajaxForm(options);
	});
	function valid() {
		$("#div_name").removeClass("control-group error");
		$("#div_name").addClass("control-group");
		$("#div_cnName").removeClass("control-group error");
		$("#div_cnName").addClass("control-group");
		$("#div_description").removeClass("control-group error");
		$("#div_description").addClass("control-group");
		//document.getElementById("help_name").innerHTML = "";
		//document.getElementById("help_cnName").innerHTML = "";
		//document.getElementById("help_description").innerHTML = "";
		var name = $("#name").val().trim();
		var cnName = $("#cnName").val().trim();
		var description = $("#description").val().trim();
		//alert("name"+name+"cnName"+cnName+"cnName"+cnName);
		if (name == "") {
			$("#div_name").removeClass("control-group");
			$("#div_name").addClass("control-group error");
			//document.getElementById("help_name").innerHTML = "英文名不能为空";
			$("#help_name").html("英文名不能为空");
			return false;
		}
		 if (cnName == "") {
			$("#div_cnName").removeClass("control-group");
			$("#div_cnName").addClass("control-group error");
			//document.getElementById("help_cnName").innerHTML = "中文名不能为空";
			$("#help_cNname").html("中文名不能为空");
			return false;
		}
		if (description == "") {
			$("#div_description").removeClass("control-group");
			$("#div_description").addClass("control-group error");
			//document.getElementById("help_description").innerHTML = "描述不能为空";
			$("#help_description").html("描述不能为空");
			return false;
		}
		return true;
	}
</script>


<div class="page-header">
	<h3 style="margin-top: auto">新增项目类别</h3>
</div>
<div class="row-fluid">
	<div>
		<form class="form-horizontal" id="add-group-form"
			action="<%=request.getContextPath()%>/pgroup/add" method="POST"
			onsubmit="return valid()">
			<div class="control-group" id="div_name">
				<label class="control-label">名称</label>
				<div class="controls">
					<input type="text" placeholder="名称" id="name" name="name"
						class="input-xlarge"> <span class="help-inline"
						id="help_name">英文${errormsg}</span>
				</div>
			</div>
			<div class="control-group" id="div_cnName">
				<label class="control-label">名称</label>
				<div class="controls">
					<input type="text" placeholder="名称" id="cnName" name="cnName"
						class="input-xlarge"> <span class="help-inline"
						id="help_cNname">中文${errormsg}</span>
				</div>
			</div>
			<div class="control-group" id="div_description">
				<label class="control-label">描述信息</label>
				<div class="controls">
					<textarea rows="3" class="input-xxlarge" placeholder="描述信息"
						id="description" name="description"></textarea>
					<span class="help-inline" id="help_description">${errormsg}</span>
				</div>
			</div>
			<div class="control-group">
				<div class="controls">
					<button type="submit" class="btn" id="submit">
						<i class="icon-ok"></i>&nbsp;确认
					</button>
					<button type="button" class="btn" style="">
						<i class="icon-remove"></i>&nbsp;取消
					</button>
				</div>
			</div>
		</form>
	</div>
</div>
